#include <iostream>
#include <stdio.h>
using namespace std;

template <typename T>
class A{    
public:
    A(T a,T b)
    {
        this->a=a;
        this->b=b;
    }

    friend A<T> sub<T>(A<T> &a1,A<T> &a2);
    //friend ostream & operator<< <T>(ostream &out,A<T> &a2);

private:
    T a;
    T b;   
};

template <typename T>
A<T> sub<T>(A<T> &a1,A<T> &a2)
{
    A<T> temp(a1.a-a2.a,a1.b-a2.b);
    return temp;
}

/*template <typename T>
ostream & operator<<(ostream &out,A<T> &a2)
{
    out<<a2.a<<" + "<<a2.b<<"i"<<endl;
    return out;
}*/

int main()
{
    A<int> aa(1,2);
    A<int> bb(2,3);
    aa = sub<int>(aa,bb);

 //   cout<<aa;
   
    return 0;
}
